package com.itheima.homework.Test07;

public class Test07 {
    /*
    【编号：707】 请定义一个描述矩形（MyRectangle）的类，包含宽和高两个属性，提供获取矩形周长（perimeter）和面积（area）的方法。
    并编写测试类进行测试。
     */
    public static void main(String[] args) {
        MyRectangle mr = new MyRectangle(4,5);
        int pe = mr.perimeter();
        int ar = mr.area();
        System.out.println("周长为-->"+pe);
        System.out.println("面积为-->"+ar);
    }
}

class MyRectangle{
    private int high;
    private int width;

    public MyRectangle() {
    }

    public MyRectangle(int high, int width) {
        this.high = high;
        this.width = width;
    }

    public int getHigh() {
        return high;
    }

    public void setHigh(int high) {
        this.high = high;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int perimeter(){
        return high*2+width*2;
    }
    public int area(){
        return high*width;
    }
}
